home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / mach-o / arch.h next >
Text File  |  1993-02-12  |  3KB  |  79 lines

  1. /*
  2.  * Copyright (c) 1993 NeXT Computer, Inc.
  3.  *
  4.  * Functions that deal with information about architectures.
  5.  *
  6.  * HISTORY
  7.  *
  8.  * 4 February 1993 Lennart Lovstrand <lennart@next.com>
  9.  *    Redesigned to use NXArchInfo based names and signatures.
  10.  *
  11.  * Originally written by Kevin Enderby at NeXT, Inc.
  12.  *
  13.  */
  14.  
  15. #import <mach/machine.h>
  16. #import <architecture/byte_order.h>
  17.  
  18. /* The NXArchInfo structs contain the architectures symbolic name
  19.  * (such as "m68k"), its CPU type and CPU subtype as defined in
  20.  * mach/machine.h, the byte order for the architecture, and a
  21.  * describing string (such as "Motorola 680x0").
  22.  * There will both be entries for specific CPUs (such as 68040) as
  23.  * well as generic "family" entries (such as 680x0).
  24.  */
  25. typedef struct {
  26.     const char *name;
  27.     cpu_type_t cputype;
  28.     cpu_subtype_t cpusubtype;
  29.     enum NXByteOrder byteorder;
  30.     const char *description;
  31. } NXArchInfo;
  32.  
  33. /* NXGetAllArchInfos() returns a pointer to an array of all known
  34.  * NXArchInfo structures.  The last NXArchInfo is marked by a NULL name.
  35.  */
  36. extern const NXArchInfo *NXGetAllArchInfos(void);
  37.  
  38. /* NXGetLocalArchInfo() returns the NXArchInfo for the local host, or NULL
  39.  * if none is known. 
  40.  */
  41. extern const NXArchInfo *NXGetLocalArchInfo(void);
  42.  
  43. /* NXGetArchInfoFromName() and NXGetArchInfoFromCpuType() return the
  44.  * NXArchInfo from the architecture's name or cputype/cpusubtype
  45.  * combination.  A cpusubtype of CPU_SUBTYPE_MULTIPLE can be used
  46.  * to request the most general NXArchInfo known for the given cputype.
  47.  * NULL is returned if no matching NXArchInfo can be found.
  48.  */
  49. extern const NXArchInfo *NXGetArchInfoFromName(const char *name);
  50. extern const NXArchInfo *NXGetArchInfoFromCpuType(cpu_type_t cputype,
  51.                           cpu_subtype_t cpusubtype);
  52.  
  53. /* NXFindBestFatArch() is passed a cputype and cpusubtype and a set of
  54.  * fat_arch structs and selects the best one that matches (if any) and returns
  55.  * a pointer to that fat_arch struct (or NULL).  The fat_arch structs must be
  56.  * in the host byte order and correct such that the fat_archs really points to
  57.  * enough memory for nfat_arch structs.  It is possible that this routine could
  58.  * fail if new cputypes or cpusubtypes are added and an old version of this
  59.  * routine is used.  But if there is an exact match between the cputype and
  60.  * cpusubtype and one of the fat_arch structs this routine will always succeed.
  61.  */
  62. extern struct fat_arch *NXFindBestFatArch(cpu_type_t cputype,
  63.                       cpu_subtype_t cpusubtype,
  64.                       struct fat_arch *fat_archs,
  65.                       unsigned long nfat_archs);
  66.  
  67. /* NXCombineCpuSubtypes() returns the resulting cpusubtype when combining two
  68.  * different cpusubtypes for the specified cputype.  If the two cpusubtypes
  69.  * can't be combined (the specific subtypes are mutually exclusive) -1 is
  70.  * returned indicating it is an error to combine them.  This can also fail and
  71.  * return -1 if new cputypes or cpusubtypes are added and an old version of
  72.  * this routine is used.  But if the cpusubtypes are the same they can always
  73.  * be combined and this routine will return the cpusubtype pass in.
  74.  */
  75. extern cpu_subtype_t NXCombineCpuSubtypes(cpu_type_t cputype,
  76.                       cpu_subtype_t cpusubtype1,
  77.                       cpu_subtype_t cpusubtype2);
  78.  
  79.